<template>
  <div id="hotTopList">
    <p class="tit">官方榜</p>
    <van-tab title="官方">
      <template>
        <div
          v-for="(item, index) in hotTopList"
          :key="item.id"
          :class="'color' + (index + 1)"
          class="hotTopList"
        >
          <div class="hotTopImg">
            <p>{{ item.name }}</p>
            <van-image :src="item.coverImgUrl" />
          </div>
          <div class="hotTopMusic">
            <p
              class="van-ellipsis"
              v-for="(items, index) in item.tracks"
              :key="index"
            >
              <span>{{ index + 1 }}. {{ items.first }}</span> -
              {{ items.second }}
            </p>
          </div>
        </div>
      </template>
    </van-tab>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
export default {
  name: 'HotTopList',
  data () {
    return {}
  },
  computed: {
    ...mapGetters(['hotTopList'])
  },
  // 定义方法
  methods: {}
}
</script>

<style scoped lang="less">
#hotTopList {
  margin-top: 15px;
  .tit {
    text-align: left;
    font-size: 18px;
    margin-left: 30px;
  }
  .hotTopList {
    display: flex;
    width: 300px;
    margin: 8px auto;
    padding: 10px;
    border-radius: 10px;
    color: #d36238;
    background-color: #f3e6de;
    .hotTopImg {
      margin-right: 20px;
      font-size: 20px;
      .van-image {
        width: 70px;
        height: 70px;
        margin-top: 5px;
      }
    }

    .hotTopMusic {
      display: flex;
      flex-direction: column;
      justify-content: space-evenly;
      align-items: flex-start;
      font-size: 12px;
      overflow: hidden;
      span {
        font-size: 14px;
      }
    }
  }
  .color1 {
    color: #bb4470;
    background: #f4e1e7;
  }
  .color2 {
    color: #328d80;
    background: #e0eaeb;
  }
  .color3 {
    color: #b9323f;
    background: #f4e2de;
  }
  .color4 {
    color: #3f6397;
    background: #e2e7ed;
  }
}
</style>
